package com.eastedu.superise.handler.ktree;

import cn.hutool.core.collection.CollectionUtil;
import com.eastedu.repository.ktree.mapper.KnowledgeNodeMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * The type Ktree service.
 * @author zhangzhishuai
 */
@Service
public class KtreeService {
    private final KnowledgeNodeMapper knowledgeNodeMapper;
    private List<String> chapterNodeIds;

    public KtreeService(KnowledgeNodeMapper knowledgeNodeMapper) {
        this.knowledgeNodeMapper = knowledgeNodeMapper;
    }

    public List<String> listChapterNodeIds() {
        if (CollectionUtil.isEmpty(chapterNodeIds)) {
            chapterNodeIds = this.knowledgeNodeMapper.listChapterNodeIds(1728835200000L);
        }
        return chapterNodeIds;
    }
}
